package com.gugee.tiktok.data.consumer.blogger.config;

import com.gugee.tiktok.data.common.config.KafkaProducerCommon;
import com.gugee.tiktok.data.common.msg.BloggerMessage;
import com.gugee.tiktok.data.common.msg.MarketMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
import org.springframework.kafka.core.KafkaTemplate;


/**
 *
 * @author luolifeng
 * Date  2020/10/04
 */
@Configuration
@EnableKafka
public class KafkaProducerBloggerConfig {
    @Autowired
    KafkaProducerCommon kafkaProducerCommon;
    @Bean
    public KafkaTemplate<Long, BloggerMessage> kafkaTemplateBlogger() {

        return new KafkaTemplate<>(kafkaProducerCommon.myKafkaProducerFactory(BloggerMessage.MsgSerializer.class));
    }
//    @Bean
//    public KafkaTemplate<Long, HashtagMessage> kafkaTemplateHashtag() {
//        return new KafkaTemplate<>(kafkaProducerCommon.myKafkaProducerFactory(HashtagMessage.MsgSerializer.class));
//    }
    @Bean
    public KafkaTemplate<Long, MarketMessage> kafkaTemplateMarket() {
        return new KafkaTemplate<>(kafkaProducerCommon.myKafkaProducerFactory(MarketMessage.MsgSerializer.class));
    }
}
